//
//  CouponViewController.m
//  duoduo
//
//  Created by wanghao on 16/10/12.
//  Copyright © 2016年 LX. All rights reserved.
//

#import "CouponViewController.h"
#import "CouponCell.h"

@interface CouponViewController ()<UITableViewDelegate,UITableViewDataSource>
{
    NSArray * moneyArr;
}
@property (nonatomic,strong) UITableView * listTableView;

@end

@implementation CouponViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    moneyArr = @[@"¥ 20",@"¥ 10",@"¥ 30",@"¥ 20"];
    self.title = @"优惠券";
    [self initUI];
}

- (void)initUI
{

    _listTableView =[[UITableView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight-5) style:UITableViewStylePlain];
    _listTableView.delegate = self;
    _listTableView.dataSource = self;
    _listTableView.backgroundColor = LXHexColor(0xF5F6F7);
    [self.view  addSubview:_listTableView];
    _listTableView.tableFooterView = [[UIView alloc]init];
    _listTableView.bounces = YES;

    [_listTableView registerNib:[UINib nibWithNibName:@"CouponCell" bundle:nil] forCellReuseIdentifier:@"couponcell"];

    self.view.backgroundColor = LXHexColor(0xF5F6F7);

}

- (void)logoutClick
{

}

#pragma mark --- UITableViewDelegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return moneyArr.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    CouponCell * cell = [tableView dequeueReusableCellWithIdentifier:@"couponcell"];

    cell.couponLabel.text = moneyArr[indexPath.section];

    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 80;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 20;
}


- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBar.hidden = NO;
    self.tabBarController.tabBar.hidden=YES;
}

@end
